package com.example.xpvideo.validator;



import com.example.xpvideo.annotations.IsFile;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @author : 洪俊新
 * @date : 2021/3/4 10:43
 * @description:
 */
public class IsFileConstraintValidator implements ConstraintValidator<IsFile, MultipartFile> {


    @Override
    public void initialize(IsFile constraintAnnotation) {

    }

    @Override
    public boolean isValid(MultipartFile value,
                           ConstraintValidatorContext context) {
        return !value.isEmpty();
    }
}
